package com.haoshuang.zhouzhoubang.ui.page.settled.autograph

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.ResponseBean
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class AutographViewModel : BaseViewModel() {

    /**
     * 合同签名
     */
    val contractSignData = StatefulMutableLiveData<ResponseBean<Any>>()
    fun contractSign(signature_img: String?) = netRequest {
        start { contractSignData.value = StateData.Loading }
        request { ApiRepo.contractSign(signature_img)  }
        success { contractSignData.value = StateData.Success(it) }
        error { code, msg ->
            contractSignData.value = StateData.Error(code, msg)
        }
    }

}